Skip to content

feat(linux): add IPv6 support for VPN gateway - #262

Merged
pymq merged 17 commits into
anywherelan:masterfrom
NNdroid:master
Jul 28, 2026
Merged

feat(linux): add IPv6 support for VPN gateway#262
pymq merged 17 commits into
anywherelan:masterfrom
NNdroid:master

Conversation

@NNdroid

@NNdroid NNdroid commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

I only implemented it on Linux.

  • Add IPNetV6 field to VpnConfig, defaulting to "fd00:66::/48".
  • Implement deterministic IPv6 address mapping derived from PeerID and persisted in config, supporting custom user overrides.

@pymq

pymq commented Jul 21, 2026

Copy link
Copy Markdown
Member

Hi, thanks for this!

I'll take a closer look later, but for now I have a few suggestions:

  • add integration tests in application_test.go to verify that IP packet routing works correctly
  • add IPv6 packet tests in vpn/packet_test.go
  • add tests for the peerIPv6FromIPv4 function
  • in .github/workflows/test.yml, in a job end-to-end-test add a test that verifies real IPv6 routing (at least on Linux). I know it'll fail for now, but I'll later update the remote peer with an awl binary built from your branch, so IPv6 routing should start working
  • I'm sure there are many more tests we could add beyond these

@NNdroid

This comment was marked as resolved.

Comment thread config/other.go Outdated
Comment thread service/tunnel.go Outdated
Comment thread service/tunnel.go
Comment thread service/tunnel.go Outdated
Comment thread socks5/server_test.go Outdated
NNdroid added 3 commits July 26, 2026 14:32
…t APIs for Android

- Refactored IPv6 derivation logic into `config/ipv6.go` for cleaner abstraction.
- Updated `VPNLocalIPMaskV6Unlocked` to automatically compute and return the derived IPv6 address based on the node's PeerID, avoiding redundant derivation in higher layers (`application.go`).
- Added `ipv6Addr` to `PeerStatusInfo` JSON payload for exchanging IPv6 addresses with peers.
- Exported `GetVpnNetworkAddressV4` and `GetVpnNetworkAddressV6` in `gomobile-lib` so the Android VPN service can query the exact subnet base addresses required for split-tunnel routing.
- Invert `if exists` in `service/tunnel.go` to reduce nestif complexity.
- Update `TestTunnelPackets` to use the new derived IPv6 addresses from config, fixing packet routing mismatch.
Comment thread cmd/gomobile-lib/main.go Outdated
Comment thread cmd/gomobile-lib/main.go Outdated
Comment thread config/other.go Outdated
Comment thread config/network_addr.go
Comment thread config/ipv6.go
Comment thread awldns/awldns.go
Comment thread service/auth_status.go Outdated
Comment thread service/tunnel.go Outdated
Comment thread service/tunnel.go
Comment thread config/ipv6_test.go

@pymq pymq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me except a few possible improvements

Comment thread awldns/awldns.go Outdated
Comment thread vpn/vpn.go Outdated
Comment thread test_suite_test.go
NNdroid added 2 commits July 27, 2026 19:03
…v6 updates

- Return both A and AAAA records for TypeANY DNS queries in awldns
- Allow updating peer.IPAddrV6 when a peer announces a changed IPv6 address in auth_status
- Trigger ensureIPv6AddressLocked in SetIdentity to prevent unassigned IPv6 prefix on fresh node configs
- Revert unintended comment formatting in test_suite_test.go
@NNdroid
NNdroid requested a review from pymq July 27, 2026 12:18
Comment thread service/auth_status.go Outdated
Comment thread service/tunnel.go
@pymq

pymq commented Jul 27, 2026

Copy link
Copy Markdown
Member

I tested it manually on my Linux machine:

  • ping to the remote IPv6 device works
  • VPN gateway works
  • I couldn't test the VPN gateway over IPv6 because I don't have an IPv6 connection available

@pymq

pymq commented Jul 27, 2026

Copy link
Copy Markdown
Member

I pushed your branch to this repo to run e2e tests:
https://github.com/anywherelan/awl/tree/NNdroid-ipv6

They all failed:
https://github.com/anywherelan/awl/actions/runs/30284786478/job/90040765234

@NNdroid

NNdroid commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

I pushed your branch to this repo to run e2e tests: https://github.com/anywherelan/awl/tree/NNdroid-ipv6

They all failed: https://github.com/anywherelan/awl/actions/runs/30284786478/job/90040765234

Okay, I'll take a look when I have some free time.

@NNdroid

NNdroid commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

I pushed your branch to this repo to run e2e tests: https://github.com/anywherelan/awl/tree/NNdroid-ipv6

They all failed: https://github.com/anywherelan/awl/actions/runs/30284786478/job/90040765234

I tested that look like fine. you can see. https://github.com/NNdroid/awl/actions/runs/30325402319

@pymq

pymq commented Jul 28, 2026

Copy link
Copy Markdown
Member

Oh, I'm sorry. It looks like the issue was on my end

@pymq

pymq commented Jul 28, 2026

Copy link
Copy Markdown
Member

Thank you so much for your work! From my perspective, it's ready to be merged. There are still a few minor things we could improve, but the Linux support looks solid.

Are you planning to push anything else to this branch, or can I go ahead and merge it?

Also, do you have any plans for follow-up PRs, such as support for other platforms or any additional improvements?

@pymq pymq added this to the v0.20.0 milestone Jul 28, 2026
@NNdroid

NNdroid commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Thank you so much for your work! From my perspective, it's ready to be merged. There are still a few minor things we could improve, but the Linux support looks solid.

Are you planning to push anything else to this branch, or can I go ahead and merge it?

Also, do you have any plans for follow-up PRs, such as support for other platforms or any additional improvements?

You can go ahead and merge it.
I am still planning IPv6 support for Windows; it requires more time.

@pymq
pymq merged commit 78001e9 into anywherelan:master Jul 28, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants